home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 19 / CU Amiga Magazine's Super CD-ROM 19 (1998)(EMAP Images)(GB)[!][issue 1998-02].iso / CUCD / Readers / Gui4Cli / Docs / Tutorials / MouseData.gc < prev    next >
Text File  |  1997-12-02  |  2KB  |  72 lines

  1. G4C
  2.  
  3. ; ----- Obtaining feedback on mouse position and
  4. ;       the colour of the pixel clicked on
  5.  
  6. ; =================================================================
  7. ;       Globals & system events
  8. ; =================================================================
  9.  
  10. WINBIG 155 60 331 131 "MouseData.gc"
  11. WinType 11110001
  12.  
  13. xonLoad 
  14. GuiOpen MouseData.gc
  15.  
  16. xonClose
  17. GuiQuit MouseData.gc
  18.  
  19. ; =================================================================
  20. ;       Graphics..
  21. ; =================================================================
  22.  
  23. BOX 0 0 0 0 OUT button
  24.  
  25. ; ---- A box surrounding the area event below 
  26. ;      Note they are the same size/position
  27.  
  28. BOX 37 30 255 80 IN RIDGE
  29.  
  30. ; ---- 3 colored shapes
  31.  
  32. SQUARE 56 40 37 60 1 FILL
  33. CIRCLE 165 70 56 30 2 FILL
  34. SQUARE 236 40 37 60 3 FILL
  35.  
  36. ; ---- Headings above the box
  37. CTEXT 37 5 'MouseData:' #screen 8 2 0 0001
  38. TEXT 37 18 189 12 'Click within the box' 20 NOBOX 
  39.  
  40. ; ---- Text gadgets to contain feedback below the box
  41. TEXT 44 113 47 12 '' 10 NOBOX
  42. gadid 1
  43. TEXT 127 113 47 12 '' 10 NOBOX
  44. gadid 2
  45. TEXT 210 113 47 12 '' 10 NOBOX
  46. gadid 3
  47.  
  48. ; =================================================================
  49. ;    The important stuff
  50. ;    -------------------
  51. ;    Marking the 'area' of the box serves two purposes :
  52. ;    1  Clicking within the area provides us with an 'event'
  53. ;       to which a reaction can be coded
  54. ;    2  It restricts events and feedback to the area required.
  55. ; We read the values of $$MOUSE.WX, $$MOUSE.WY, and $$MOUSE.COLOR
  56. ; to obtain the required information.
  57. ; =================================================================
  58.  
  59. XAREA 37 30 255 80 NONE
  60. update MouseData.gc 1 'X = $$MOUSE.WX'
  61. update MouseData.gc 2 'Y = $$MOUSE.WY'
  62. update MouseData.gc 3 'Colour = $$MOUSE.COLOR'
  63.  
  64. ; =================================================================
  65. ; Note that X and Y can also be obtained as SCREEN coordinates, 
  66. ; but here we read only the window coordinates.
  67.  
  68.  
  69.  
  70.  
  71.  
  72.